<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:p="http://primefaces.org/ui">

<h:head>
	<h:outputStylesheet name="common-style.css" library="css" />
	<title>Quản trị - Kết quả bốc thăm trúng thưởng</title>
	<link rel="shortcut icon" type="image/x-icon"
		href="#{request.contextPath}/resources/images/favicon.ico" />
</h:head>
<h:body style="font-size: 11px;">
	<p:layout style="height:800px;width:1200px; margin:0 auto;" id="layout">
		<p:layoutUnit position="center">
			<p:graphicImage value="/resources/images/MDB.jpg" width="250"
				height="90" />

			<p:ajaxStatus onstart="modalDialogTest.show();"
				onsuccess="modalDialogTest.hide();" />
			<p:dialog id="modalDialog" showHeader="false" closable="true"
				widgetVar="modalDialogTest" modal="true">
				<p:graphicImage value="/resources/images/482.GIF" />
			</p:dialog>
			<h:form id="frmResult1">
				<ui:insert name="menu">
					<ui:include src="/admin/menu.xhtml" />
				</ui:insert>
				<p:panel
					header="BỐC THĂM TRÚNG THƯỞNG">
					<p:dataTable id="dblResults" var="resultVar"
						value="#{resultBean.listResults}" paginator="true" rows="20" emptyMessage="Chưa có thông tin"
						paginatorTemplate="{CurrentPageReport}  {FirstPageLink} {PreviousPageLink} {PageLinks} {NextPageLink} {LastPageLink} {RowsPerPageDropdown}"
						paginatorPosition="bottom" rowsPerPageTemplate="15,20,25">
						<f:facet name="header">
							<p:commandButton value="BỐC THĂM TRÚNG THƯỞNG"
								oncomplete="resultsDlg.show();" icon="ui-icon-person"
								style="float:right;" />
								<h:outputText value="DANH SÁCH KHÁCH HÀNG TRÚNG THƯỞNG" style="float:left;"/>
						</f:facet>
						<p:column headerText="ĐIỂM GIAO DỊCH">
							<h:outputText value="#{resultVar.branch}" />
						</p:column>
						<p:column headerText="NGÀY BỐC THĂM">
							<h:outputText value="#{resultVar.dateCreated}">
							<f:convertDateTime type="date" pattern="dd/MM/yyyy" />
							</h:outputText>
						</p:column>
						<p:column headerText="SỐ CIF">
							<h:outputText value="#{resultVar.customerId}" />
						</p:column>

						<p:column headerText="TÊN KHÁCH HÀNG">
							<h:outputText value="#{resultVar.customerName}" />
						</p:column>

						<p:column headerText="SỐ THAM CHIẾU">
							<h:outputText value="#{resultVar.refNo}" />
						</p:column>
						<p:column headerText="MÃ DỰ THƯỞNG">
							<h:outputText value="#{resultVar.lkrNumber}" />
						</p:column>
						<p:column headerText="GIẢI THƯỞNG">
							<h:outputText value="#{resultVar.awards}" />
						</p:column>
						<p:column headerText="NHÓM">
							<h:outputText value="#{resultVar.agroup}" />
						</p:column>
					</p:dataTable>


				</p:panel>
				<p:dialog
					header="BỐC THĂM TRÚNG THƯỞNG"
					widgetVar="resultsDlg" id="resultsDlg" showEffect="clip"
					hideEffect="clip" closable="true">
					<p:fieldset>
						<h:panelGrid id="display" columns="3" style="width:500px;">
							<p:selectOneMenu value="#{resultBean.awards}">
								<f:selectItem itemLabel="Chọn giải thưởng" itemValue="0" />
								<f:selectItem itemLabel="Giải Nhất - 5 lượng vàng" itemValue="1" />
								<f:selectItem itemLabel="Giải Nhì - 1 lượng vàng" itemValue="2" />
								<f:selectItem itemLabel="Giải Ba - Iphone 5S" itemValue="3" />
								<f:selectItem itemLabel="Giải Tư - 1 chỉ vàng" itemValue="4" />
								<f:selectItem itemLabel="Giải IB + Thẻ - 1 chỉ vàng"
									itemValue="5" />
							</p:selectOneMenu>
							<p:inputText value="#{resultBean.luckyDrawNumber}" />
							<p:commandButton value="Xem kết quả"
								action="#{resultBean.getLuckyCustomer}"
								update=":frmResult1:displayBonus,:frmResult1:displayButton,:frmResult1:msgResults"
								icon="ui-icon-search" />

						</h:panelGrid>
					</p:fieldset>
					<p:fieldset>
						<p:messages id="msgResults" showDetail="true" autoUpdate="true"
							closable="true" />
					</p:fieldset>
					<p:fieldset>
						<h:panelGrid id="displayBonus" columns="2">
							<h:outputText value="Điểm giao dịch:" />
							<h:outputText value="#{resultBean.results.branch}"
								style="font-weight:bold" />
							<h:outputText value="Mã khách hàng:" />
							<h:outputText value="#{resultBean.results.customerId}"
								style="font-weight:bold" />
							<h:outputText value="Tên khách hàng:" />
							<h:outputText value="#{resultBean.results.customerName}"
								style="font-weight:bold" />

							<h:outputText value="Giải thưởng:" />
							<h:outputText value="#{resultBean.results.awards}"
								style="font-weight:bold" />
							<h:outputText value="Nhóm:" />
							<h:outputText value="#{resultBean.results.agroup}"
								style="font-weight:bold" />
							<h:outputText value="Mã dự thưởng:" />
							<h:outputText value="#{resultBean.results.lkrNumber}"
								style="font-weight:bold" />
						</h:panelGrid>

					</p:fieldset>
					<p:fieldset>
						<h:panelGrid id="displayButton" columns="2">
							<p:commandButton value="Lưu"
								disabled="#{resultBean.checkSave == 0}"
								action="#{resultBean.saveLuckyCustomer}"
								update=":frmResult1:displayBonus,:frmResult1:displayButton,:frmResult1:msgResults,:frmResult1:dblResults"
								icon="ui-icon-check" />
						</h:panelGrid>

					</p:fieldset>

				</p:dialog>
			</h:form>

		</p:layoutUnit>
		<h:outputText
			value="Bản quyền &#169; 2013 Ngân hàng TMCP Phát Triển Mê Kông. Xây dựng bởi Đỗ Đức Tú."
			style="font-style:italic;" />
	</p:layout>
</h:body>
</html>